package com.yuexun.beilunpatient.ui.my.ui;

import android.os.Bundle;
import android.widget.TextView;

import com.yuexun.beilunpatient.R;
import com.yuexun.beilunpatient.base.BaseKJActivity;
import com.yuexun.beilunpatient.config.AppConfig;
import com.yuexun.beilunpatient.ui.bean.BaseListEntity;
import com.yuexun.beilunpatient.ui.login.bean.UserDtlBean;
import com.yuexun.beilunpatient.ui.login.model.impl.LoginModel;
import com.yuexun.beilunpatient.ui.login.presenter.impl.UserDtlPresenter;
import com.yuexun.beilunpatient.ui.login.ui.view.IUserDtlView;

import org.kymjs.kjframe.utils.PreferenceHelper;

import java.util.HashMap;
import java.util.Map;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by chenss on 2018/9/26.
 */
public class Act_HealthNo extends BaseKJActivity implements IUserDtlView {

    @Bind(R.id.healthNo)
    TextView healthNo;

    UserDtlPresenter presenter;

    @Override
    public void setRootView() {
        setContentView(R.layout.act_healthno);
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {
        super.initData();
        presenter = new UserDtlPresenter(new LoginModel(), this);
        Map<String, String> params = new HashMap<>();
        params.put("patientId", PreferenceHelper.readString(aty, AppConfig.USER_INFO, AppConfig.PATIENT_ID));
        params.put("sessionUuidPatient", PreferenceHelper.readString(aty, AppConfig.USER_INFO, AppConfig.SESSION_ID));
        presenter.loadPatientInfoDetail(params);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick(R.id.title_back)
    public void onViewClicked() {
        finish();
    }

    @Override
    public void loadPatientInfoDetail(BaseListEntity<UserDtlBean> entity) {
        if(entity.getStatus().equals("200")){
            healthNo.setText(entity.getDatas().get(0).getHealthNo());
        }
    }
}
